<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>店铺信息</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css" />
      <link rel="stylesheet" type="text/css" href="../../css/common.css" />
      <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #ffffff;}
          .aui-active .aui-bar-tab-label{
            color: #f5a51c
          }
          .login {height:10rem;background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);/*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/position: relative;}
      	  .login .personal_logo {width: 3rem;height: 3rem;border:1px solid #fff; }
      		.login .userinfo .title {font-size: 0.8rem; color: #fff;}
      		/* 设置条目 */
      		.item {height: 3rem;line-height: 3rem;padding-left: 0.7rem;background-color: #fff;}
      		.item_ico {float: left;width: 2.3rem;padding: 0.7rem 0.7rem 0.7rem 0;}
      		.item_arrow {float: right;width: 1.5rem;padding: 1rem 0.7rem 1rem 0;}
      		.item span {font-size: 0.7rem;}
          [v-cloak] {
              display: none;
          }
          .aui-list .aui-list-item-right{
            max-width: 65%;
          }
          .aui-grid [class*=aui-col-]{
            padding: 0.2rem
          }
          .aui-toast-content{
              color: #fff;
          }
      </style>
  </head>
  <body>
<div id="app" >
    <div class="aui-refresh-content">
<div class="user_nav_line"></div>
  <ul class="aui-list aui-media-list">
      <li class="aui-list-item aui-list-item-middle" @click="tast()">
          <div class="aui-media-list-item-inner">
              <div class="aui-list-item-inner aui-list-item-arrow">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">店铺logo</div>
                      <div class="aui-list-item-right aui-font-size-14" style="color:#000">
                        <img :src=storeMsg.logo alt="" style="width:2rem;" v-show="storeMsg.logo!=''">
                        <img src='../../image/my/LOGO.png' alt="" style="width:2rem;" v-show="storeMsg.logo==''">
                      </div>
                  </div>

              </div>
          </div>
      </li>
      <li class="aui-list-item aui-list-item-middle" @click="storeName()">
          <div class="aui-media-list-item-inner aui-list-item-arrow">
              <div class="aui-list-item-inner">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">店铺名</div>
                      <div class="aui-list-item-right aui-font-size-14" style="color:#000;padding-right: 0.6rem;">{{storeMsg.name}}</div>
                  </div>

              </div>
          </div>
      </li>
  </ul>
  <div class="user_nav_line"></div>
  <ul class="aui-list aui-media-list">
      <li class="aui-list-item aui-list-item-middle" @click="openTime()">
          <div class="aui-media-list-item-inner">
              <div class="aui-list-item-inner aui-list-item-arrow">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">营业时间</div>
                      <div class="aui-list-item-right aui-font-size-14" style="color:#000;">{{storeMsg.business_time}}</div>
                  </div>

              </div>
          </div>
      </li>
      <li class="aui-list-item aui-list-item-middle" @click="changePhone()">
          <div class="aui-media-list-item-inner aui-list-item-arrow">
              <div class="aui-list-item-inner">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">联系方式</div>
                      <div class="aui-list-item-right aui-font-size-14" style="color:#000;padding-right: 0.6rem;">{{storeMsg.kefu_tel}}</div>
                  </div>

              </div>
          </div>
      </li>
      <li class="aui-list-item aui-list-item-middle" onclick="storeAdd()">
          <div class="aui-media-list-item-inner aui-list-item-arrow">
              <div class="aui-list-item-inner">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">店铺地址</div>
                      <div class="aui-list-item-right aui-font-size-14" style="color:#000;padding-right: 0.6rem;">{{storeMsg.province}}{{storeMsg.city}}{{storeMsg.district}}</div>
                  </div>

              </div>
          </div>
      </li>
  </ul>
  <div class="user_nav_line"></div>
  <ul class="aui-list aui-media-list">
      <li class="aui-list-item-middle" style="margin-left:0.75rem" onclick="real()">
          <div class="aui-media-list-item-inner">
              <div class="aui-list-item-inner aui-list-item-arrow">
                  <div class="aui-list-item-text">
                      <div class="aui-list-item-title aui-font-size-14 index_five_my">店铺实景</div>
                  </div>

              </div>
          </div>
      </li>
  </ul>
  <section class="aui-grid aui-margin-b-15">
    <div class="aui-row">
        <div class="aui-col-xs-4"  v-for="value in storeMsg.outdoor_scene">
            <img :src=value alt="">
        </div>

    </div>
</section>



 </div>
</div>
  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/zepto.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript" src="../../script/utils.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript" src="../../script/aui-tab.js"></script>
  <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  <script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
  <script type="text/javascript" src="../../script/aui-toast.js"></script>
  <script type="text/javascript">
  function storeAdd(){
    api.openWin({
        name: 'storeAddData',
        url: './headerone.html',
        pageParam: {
            msg:'店铺地址',
            url:'./storeAddData.html'
        }
    });

  }

      function real(){
        api.openWin({
            name: 'real',
            url: './headerone.html',
            pageParam: {
                msg:'店铺资料',
                url:'./real.html'
            }
        });

      }
      function goback(){
        api.closeWin();
      }
      apiready = function(){
         var toast = new auiToast({});
        new Vue({
          el:'#app',
          data:{
              storeMsg:{},
              userImg:''
          },
          methods:{
            //修改号码
            changePhone:function(){
              var _this = this;
              api.openWin({
                  name: 'user_list',
                  url: './user_phone_list0.html',
                  pageParam:{
                    name:_this.storeMsg.kefu_tel
                  }

              });

            },
            //修改营业时间
            openTime:function(){
              var _this = this;
              api.openWin({
                name:'openTime',
                url:'./openTime.html',
                pageParam:{
                  msg:_this.storeMsg.business_time
                }
              })
            },
            storeName:function(){
              var _this = this;
              api.openWin({
                  name: 'storeName',
                  url: './storeName.html',
                  pageParam: {
                      msg:_this.storeMsg.name

                  }
              });
            },
            //修改接口
            setUserInfo:function(){
              var _this = this;
              api.ajax({
                  url:window.Url.Freestore_setInfo,
                  method: 'post',
                  data: {
                      values: {
                          token:$api.getStorage('token'),
                      },
                      files: {
                          logo:_this.userImg
                      }
                  }
              },function(ret, err){
                  if (ret.re==1) {
                      toast.success({
                        title:ret.info,
                        duration:1000
                      })
                      api.execScript({
                         name: 'root',
                         //frameName: 'five_frame/index.html',
                         script: 'window.location.reload();'
                     });
                     window.location.reload();
                  } else {
                      toast.fail({
                        title:ret.info,
                        duration:1000
                      })
                  }
              });

            },
            //修改头像
            tast:function(){
              var _this = this;
              api.actionSheet({
                  title: '更改头像',
                  cancelTitle: '取消',
                  buttons: ['图片','拍照']
              }, function(ret, err) {
                  if (ret.buttonIndex==2) {
                     _this.personImg('camera')
                  }else if(ret.buttonIndex==1){
                    _this.personImg('library')
                  }
              });
            },
            personImg:function(type){
              var _this = this;
             api.getPicture({
                 sourceType: type,
                 encodingType: 'jpg',
                 mediaValue: 'pic',
                 destinationType: 'url',
                 allowEdit: true,
                 quality: 50,
                 targetWidth: 100,
                 targetHeight: 100,
                 saveToPhotoAlbum: false
             }, function(ret, err){
                 if(ret){
                    //  alert(JSON.stringify(ret));
                    if(ret.data!=''){
                      _this.userImg = ret.data;
                      _this.setUserInfo();
                    }
                 }
             });

           },
            //刷新
            setRefresh:function() {
                var pullRefresh = new auiPullToRefresh({
                    container: document.querySelector('.aui-refresh-content'),
                    triggerDistance: 100
                }, function(ret) {

                    if (ret.status == "success") {
                        setTimeout(function() {
                            pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                        }, 1500)
                    }
                })
            },
            //店铺信息接口
            FreestoreIndex:function(){
                var _this = this;
                api.ajax({
                    url: window.Url.Freestore_index,
                    method: 'post',
                    data: {
                        values: {
                          token:$api.getStorage('token'),
                          store_id:$api.getStorage('storeId')
                        }

                    }
                },function(ret, err){
                  // alert(JSON.stringify(ret))
                    if (ret.re==1) {
                        _this.storeMsg = ret.data;

                    } else {
                      toast.fail({
                        title:ret.info,
                        duration:1000
                      })
                    }
                });

            }
          },
          mounted:function(){
            this.setRefresh();
            this.FreestoreIndex();
          }
        })
      };


  </script>
  </html>
